<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="public/css/layui.css" media="all" />
		<link rel="stylesheet" href="public/css/login.css">
	</head>
	<body>

		<form class="layui-form" action="/UserLogin" method="post">
			<div class="container">
				<div class=" layui-word-aux">
					国体中心飞镖争霸赛后台管理系统
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">
						<input type="text" name="username" id="username" required lay-verify="required|username" placeholder="用户名" autocomplete="off"
						 class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密 &nbsp;&nbsp;码</label>
					<div class="layui-input-block">
						<input type="password" name="password" id="password" required lay-verify="required|pass" placeholder="密码" autocomplete="off"
						 class="layui-input">
					</div>
					<!-- <div class="layui-form-mid layui-word-aux">辅助文字</div> -->
				</div>

				<button class="layui-btn" lay-submit lay-filter="formDemo">登&nbsp;&nbsp;录</button>
			</div>
		</form>
		<div class="loginBg"></div>
		<canvas id="bgCanvas"></canvas>

		<script type="text/javascript" src="../../layui/layui.js"></script>
		<script src="ribbon.js" type="text/javascript" charset="utf-8"></script>
		<script>
			//首先定义一个fales true
			function showloading(t) {
				if (t) { //如果是true则显示loading
					console.log(t);
					loading = layer.load(1, {
						shade: [0.1, '#fff'] //0.1透明度的白色背景
					});
				} else { //如果是false则关闭loading
					console.log("关闭loading层:" + t);
					layer.closeAll('loading');
				}
			}

			layui.use('form', function() {
				var form = layui.form;
				var layer = layui.layer;
				$ = layui.jquery,
					form.verify({
						username: function(value, item) { //value：表单的值、item：表单的DOM对象
								if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
									return '用户名不能有特殊字符';
								}
								if (/(^\_)|(\__)|(\_+$)/.test(value)) {
									return '用户名首尾不能出现下划线\'_\'';
								}
								if (/^\d+\d+\d$/.test(value)) {
									return '用户名不能全为数字';
								}
							},
						pass: [/^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格']
					});

				//监听提交
				form.on('submit(formDemo)', function(data) {
					$(this).text("登录中...").attr("disabled", "disabled").addClass("layui-disabled");
					var index = layer.msg('登录中，请稍候', {
						icon: 16,
						time: false,
						shade: 0.8
					});
					setTimeout(function() {
						
						window.location.href = "../../index.html";
					}, 1000);


					return false;
				});


			});

			
		</script>
	</body>
</html>
